Use Windows.pkg
Use DFClient.pkg
Use dfTabDlg.pkg
Use cAlbumDataDictionary.dd
Use cArtistDataDictionary.dd
Use cSongDataDictionary.dd
Use cComposerDataDictionary.dd
Use cSysFileDataDictionary.dd
Use dfSelLst.pkg

Deferred_View Activate_oStatistics for ;
Object oStatistics is a dbView
    Property String psMboxCaption "Statistics"
    Set Border_Style to Border_Thick
    Set Size to 188 225
    Set Location to 2 2
    Set Label to "Music Collection Statistics"
    Set Icon to "music.ico"

    Object oTabDialogView is a dbTabDialogView
        Property Handle phoArtistList
        Property Handle phoComposerList
        
        Set Size to 175 211
        Set Location to 6 7
        Set peAnchors to anAll
        

        Object oArtistTab is a dbTabView
            Set Label to "Arti&st"
            
            Object oArtist_DD is a cArtistDataDictionary
            End_Object
            
            Set Main_DD to oArtist_DD
            Set Server to oArtist_DD

            Object oArtistList is a dbList
                Set phoArtistList to Self
                Set Size to 150 194
                Set Location to 5 7
                Set Server to oArtist_DD
                Set peAnchors to anAll
                Set peResizeColumn to rcAll
                Set Move_Value_Out_State to False
                
                Begin_Row
                    Entry_Item Artist.ARTIST
                    Entry_Item Artist.TOTAL_SONGS
                End_Row

                Set Form_Width 0 to 138
                Set Header_Label 0 to "Artist"
                Set Form_Width 1 to 47
                Set Header_Label 1 to "# Songs"
                Set CurrentRowColor to clWindow
                Set CurrentCellColor to clWindow
                Set Enabled_State to False
                
            End_Object
        End_Object

        Object oComposerTab is a dbTabView
            Set Label to "&Composer"
            
            Object oComposer_DD is a cComposerDataDictionary
            End_Object
            
            Set Main_DD to oComposer_DD
            Set Server to oComposer_DD

            Object oComposerList is a dbList
                Set phoComposerList to Self
                Set Location to 5 7
                Set Server to oComposer_DD
                Set Size to 150 194
                Set peAnchors to anAll
                Set peResizeColumn to rcAll
                Set Move_Value_Out_State to False

                Begin_Row
                    Entry_Item Composer.COMPOSER
                    Entry_Item Composer.TOTAL_SONGS
                End_Row

                Set Form_Width 0 to 138
                Set Header_Label 0 to "Composer"
                Set Form_Width 1 to 47
                Set Header_Label 1 to "# Songs"
                Set CurrentRowColor to clWindow
                Set CurrentCellColor to clWindow
                Set Enabled_State to False
            End_Object
        End_Object

        Object oSysFileTab is a dbTabView
            Set Label to "&General"
            Object oSysFile_DD is a cSysFileDataDictionary
            End_Object
            
            Set Main_DD to oSysFile_DD
            Set Server to oSysFile_DD

            Object oTotalAlbums is a dbForm
                Entry_Item SysFile.TOTAL_ALBUMS
                Set Size to 13 100
                Set Location to 41 52
                Set Label to "Total Albums:"
                Set Label_Justification_Mode to JMode_Top
                Set Label_Col_Offset to 0
                Set Enabled_State to False
            End_Object

            Object oTotalSongs is a dbForm
                Entry_Item SysFile.TOTAL_SONGS
                Set Size to 13 100
                Set Location to 80 52
                Set Label to "Total Songs:"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
                Set Enabled_State to False
            End_Object
            
            Procedure UpdateTotals
                Clear SysFile
                Find GT SysFile by Recnum
                Send Request_Find of oSysFile_DD EQ SysFile.File_Number 0
            End_Procedure
        End_Object
        
        Procedure UpdateAllTabs
            Send Beginning_of_Data to (phoArtistList(Self))
            Send Beginning_of_Data to (phoComposerList(Self))
            Send UpdateTotals to oSysFileTab
        End_Procedure
        
        Procedure Switch_To_Artist
            Send Request_Switch_To_Tab 0 3
        End_Procedure
        
        Procedure Switch_To_Composer
            Send Request_Switch_To_Tab 1 3
        End_Procedure
        
        Procedure Switch_To_System
            Send Request_Switch_To_Tab 2 3
        End_Procedure
        
        On_Key Key_Alt+Key_S Send Switch_To_Artist
        On_Key Key_Alt+Key_C Send Switch_To_Composer
        On_Key Key_Alt+Key_G Send Switch_To_System
    End_Object
    
    Procedure OnSetFocus
        Send UpdateAllTabs to oTabDialogView        
    End_Procedure

Cd_End_Object
